using System;
using UnityEngine;

namespace BitMango.MultiPlayer.Editor
{
	public class MatchEditor101 : MatchImplBase
	{
		protected override void OpenImpl(int _gameVariant, Action<bool> callback)
		{
			UnityEngine.Debug.Log("MatchEditor101.OpenImpl");
			Match.Me = new Match.User();
			Match.Opponent = new Match.User();
			Match.IsMaster = true;
			TaskManager.DoSecondsAfter(delegate
			{
				base.OnOpenInternal(true);
			}, 1f);
		}

		protected override void CloseImpl(bool opponent)
		{
			UnityEngine.Debug.Log("MatchEditor101.CloseImpl");
		}

		protected override void SendInternalImpl(byte cmd, object msg)
		{
			UnityEngine.Debug.Log("MatchEditor101.SendInternalImpl : " + (PACKET)cmd);
			TaskManager.DoSecondsAfter(delegate
			{
				if (cmd == 1)
				{
					MatchImplBase.ReadyPacket readyPacket = msg as MatchImplBase.ReadyPacket;
					Match.Me.userData = readyPacket.userData;
					Match.Opponent.userData = readyPacket.userData;
				}
				if (cmd != 3)
				{
					this.OnRecvInternal(cmd, msg);
				}
			}, 1f);
		}
	}
}
